package com.zhyz.bookstore.service.impl;

import com.zhyz.bookstore.dao.impl.OrderDaoImpl;
import com.zhyz.bookstore.dao.impl.OrderItemsDaoImpl;
import com.zhyz.bookstore.entity.OrderItems;
import com.zhyz.bookstore.entity.Orders;
import com.zhyz.bookstore.entity.User;
import com.zhyz.bookstore.service.OrdersService;

import java.util.List;

public class OrdersServiceImpl implements OrdersService {
    private  OrderDaoImpl orderDao = new OrderDaoImpl();
    private  OrderItemsDaoImpl itemsDao = new OrderItemsDaoImpl();

    @Override
    public List<Orders> queryOrdersByUser(User user) {
        return orderDao.queryOrdersByUser(user);
    }

    @Override
    public List<Orders> queryOrderByAdmin() {
        return orderDao.queryOrderByAdmin();
    }

    @Override
    public boolean deleteOrderByOrderId(String orderId) {
        return orderDao.deleteOrderByOrderId(orderId);
    }

    @Override
    public boolean deliverOrder(String orderId, int status) {
        return orderDao.deliverOrder(orderId, status);
    }

    @Override
    public void save(Orders o) {
        orderDao.save(o);
    }

    @Override
    public List<OrderItems> queryOrderItemsByOrderId(String orderId) {
        return itemsDao.queryOrderItemsByOrderId(orderId);
    }

}
